package com.itheima;

import com.itheima.config.SpringConfig;
import com.itheima.dao.BookDao;
import com.itheima.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AnnAPP {
    public static void main(String[] args) {
        //1.解析配置类，获得容器
        ApplicationContext app = new AnnotationConfigApplicationContext(SpringConfig.class);
        //2.获取bean 使用
        //获取dao
        BookDao bookDao = app.getBean(BookDao.class);
        bookDao.save();
        //获取service
        BookService bookService = app.getBean(BookService.class);
        bookService.save();
    }
}
